package cn.edu.stu.syllabus.main;

import cn.edu.stu.syllabus.api.BannerApi;
import cn.edu.stu.syllabus.repository.banner.BannerDataSource;
import cn.edu.stu.syllabus.repository.banner.local.BannerLocalDataSource;
import cn.edu.stu.syllabus.repository.banner.remote.BannerRemoteDataSource;
import cn.edu.stu.syllabus.di.scope.FragmentScoped;
import cn.edu.stu.syllabus.di.qualifier.Local;
import cn.edu.stu.syllabus.di.qualifier.Remote;
import cn.edu.stu.syllabus.utils.SchoolRetrofit;
import dagger.Module;
import dagger.Provides;

/**
 * Created by daidaijie on 2017/3/11.
 */

@Module
public class MainPresenterModule {

    private final MainContract.View mView;

    public MainPresenterModule(MainContract.View view) {
        mView = view;
    }

    @Provides
    @FragmentScoped
    MainContract.View provideView() {
        return mView;
    }

    @FragmentScoped
    @Provides
    @Local
    BannerDataSource provideBannerLocalDataSource() {
        return new BannerLocalDataSource();
    }

    @FragmentScoped
    @Provides
    @Remote
    BannerDataSource provideTasksRemoteDataSource(BannerApi bannerApi) {
        return new BannerRemoteDataSource(bannerApi);
    }


    @Provides
    @FragmentScoped
    BannerApi provideBannerApi() {
        return SchoolRetrofit.getRetrofit().create(BannerApi.class);
    }

}
